﻿using Entity;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IDal
{
    /// <summary>
    /// Dal父类接口
    /// </summary>
    public interface IBaseDal<T> where T : BaseEntity
    {


        /// <summary>
        /// 添加
        /// </summary>
        /// <returns></returns>
        public bool CreateEntity(T entity);


        ///// <summary>
        /// 获取数据集
        /// </summary>
        public DbSet<T> GetDbSet();

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool UpdateEntity(T entity);

        /// <summary>
        /// 真删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteEntityById(string id);

        /// <summary>
        /// 批量真删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool BatchDeleteEntity(List<T> entity);

        /// <summary>
        /// 真删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool DeleteEntity(T entity);
    }
}
